require("../../utils/util.js");

var e = require("../../requests/newapi.js").getCarNews;

Component({
    options: {
        multipleSlots: !0
    },
    properties: {
        modelshow: {
            type: Boolean,
            value: !1
        }
    },
    data: {
        dealerList: [],
        loading: !1,
        defaultcar: {}
    },
    methods: {
        showDealer: function(a, t) {
            var r = this, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
            console.log(i);
            e({
                op: "bit.dealer.infolistbyserialid2017",
                serialid: a,
                cityid: t
            }).then(function(e) {
                var a = e.Data.List;
                a.map(function(e) {
                    e.DealerBizModeName && (e.DealerBizModeName = e.DealerBizModeName.replace("店", ""));
                }), r.setData({
                    dealerList: a,
                    defaultcar: i
                });
            }).catch(function(e) {
                console.log(e);
            });
        },
        telDealer: function(e) {
            wx.showModal({
                title: "拨打电话",
                content: "电话号码：" + e.currentTarget.dataset.tel,
                success: function(a) {
                    a.confirm && wx.makePhoneCall({
                        phoneNumber: e.currentTarget.dataset.tel
                    });
                }
            });
        },
        order: function(e) {
            var a = e.currentTarget.dataset, t = a.carid, r = a.cityid, i = a.dealerid, d = a.dealername, l = a.subordertype, n = this.data.defaultcar, o = n.carimage, c = n.cartitle;
            wx.navigateTo({
                url: "../xunjia/xunjia?carid=" + t + "&cityid=" + r + "&dealerid=" + i + "&img=" + o + "&carname=" + c + "&dealername=" + d + "&subordertype=" + l
            });
        },
        loan: function(e) {
            var a = e.currentTarget.dataset, t = a.carid, r = a.cityid, i = a.dealerid, d = a.dealername, l = a.subordertype, n = this.data.defaultcar, o = n.carimage, c = n.cartitle;
            wx.navigateTo({
                url: "../xunjia/xunjia?carid=" + t + "&cityid=" + r + "&dealerid=" + i + "&img=" + o + "&carname=" + c + "&dealername=" + d + "&subordertype=" + l
            });
        }
    }
});